<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=7" />
        <title>后台管理中心</title>
        <?php echo $this->_var['system_css']; ?>
        <?php echo $this->_var['system_js']; ?>

    </head>
    <body>
        <?php echo $this->fetch('message.html'); ?>
        <div class="pad-10">
            <div class="common-form">
                <form name="myform" action="#" method="post" id="myform">
                    <fieldset>
                        <legend>基本信息</legend>
                        <table width="100%" class="table_form">
                            <tr>
                                <td width="80">分类名称</td> 
                                <td><input type="text" name="name"  class="input-text" id="name" size="50"></input></td>
                            </tr>
                            <tr>
                                <td>上级分类</td>
                                <td id="parent_select">
                                   <?php echo $this->_var['category_option']; ?>		
                                    &nbsp;

                                </td>
                            </tr>
                            <tr>
                                <td>
                                    是否显示
                                </td>
                                <td>
                                    <label style="width:88px"><input type="radio" value="1" checked="checked" name="is_show"> 是 </label>
                                    <label style="width:88px"><input type="radio" value="2"   name="is_show"> 否 </label>
                                </td>
                            </tr>
                               <tr>
                                <td>
                                    推荐类型
                                </td>
                                <td>
                                  热门:<input type="radio" value="1" name="is_hot">是<input type="radio" value="0" name="is_hot" checked="true">否
                                    ——推荐：<input type="radio" value="1"   name="is_best">是<input type="radio" value="0" name="is_best" checked="true">否
                                </td>
                            </tr>
                            <tr>
                                <td>META Title</td> 
                                <td><input type="text" name="title"  value="" class="input-text" size="50"></input></td>
                            </tr>
                            <tr>
                                <td>META Keywords</td> 
                                <td> <textarea  style="width:50%;height:46px;"  name="keywords"></textarea></td>
                            </tr>
                            <tr>
                                <td>META Description</td>
                                <td>
                                    <textarea  style="width:50%;height:46px;"  name="description"></textarea>
                                </td>
                            </tr>
                            <tr>
                                <td>排序</td>
                                <td>
                                    <input type="text" name="position" value="9999" class="input-text" size="10"></input>
                                </td>
                            </tr>
                            <tr align="center">
                                <td colspan="2">
                                    <input type="submit" value="提交" name="dosubmit" class="button">

                                </td>
                            </tr>
                        </table>
                    </fieldset>
                </form>
            </div>
        </div>
        <script>

            $(function(){
                $('.parent_id').change(function(){
                    $(this).next('.parent_id').remove();
                })
            });
            
            
            function change_category(category_sub){
                $('.parent_id').change(function(){
                    $(this).next('.parent_id').remove();
                })
                $.ajax({
                    url:"<?php echo $this->_var['site_url']; ?>admin/ajax/category_sub",
                    type:'post',
                    dataType:'html',
                    data:'id='+category_sub.value,
                    success:function(data){
                        if(data != ''){
                            var html = "<select class='parent_id' name='parent_id[]' onchange='change_category(this)'><option value='0'>==不选择==</option>";
                            html +=data+"</select>";
                            $('#parent_select').append(html);
                        } else{
                             $(this).next('.parent_id').remove();
                        }
                    }
                });
            }
        </script>
    </body>
</html>